﻿<if condition="ACTION_NAME eq 'medicinalList' ">
    {:W('Nav',array('name'=>'药师审核列表'))}
<else/>
    {:W('Nav',array('name'=>'审核管理员审核列表'))}
</if>
<script type="text/javascript" src="__PUBLIC__/Js/js/utils.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/js/listtable.js"></script><!-- 商品搜索 -->
<!--<div class="form-div">-->
    <!--<form action="javascript:searchGoods()" name="searchForm">-->
        <!--<img src="__PUBLIC__/Images/images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH"/>-->
        <!--&lt;!&ndash; 分类 &ndash;&gt;-->
        <!--<select name="cat_id">-->
            <!--<option value="0">所有分类</option>-->
        <!--</select>-->
        <!--&lt;!&ndash; 上架 &ndash;&gt;-->
        <!--<select name="is_on_sale">-->
            <!--<option value=''>全部</option>-->
            <!--<option value="1">上架</option>-->
            <!--<option value="0">下架</option>-->
        <!--</select>-->
        <!--&lt;!&ndash; 审核状态&ndash;&gt;-->
        <!--<select name="is_check">-->
            <!--<option value=''>全部</option>-->
            <!--<option value="5">未审核</option>-->
            <!--<option value="1">审核提交</option>-->
            <!--<option value="2">药师审核通过</option>-->
            <!--<option value="3">审核管理员审核通过</option>-->
        <!--</select>-->
        <!--关键字 <input type="text" name="keyword" size="15"/>-->
        <!--<input type="submit" value=" 搜索 " class="button"/>-->
    <!--</form>-->
<!--</div>-->


<!-- 商品列表 -->
    <!-- start goods list -->
    <div class="list-div" id="listDiv">
        <table cellpadding="3" cellspacing="1">
            <tr>
                <th>编号<img src="__PUBLIC__/Images/images/sort_desc.gif"/></th>
                <th>商品名称</th>
                <th>货号</th>
                <th>价格</th>
                <th>审核状态</th>
                <th>上架</th>
                <th>推荐排序</th>
                <th>库存</th>
                <th>虚拟销量</th>
                <th>操作</th>
            </tr>
            <foreach name="goodsArr" item="v">
                <tr>
                    <td>{$v.id}</td>
                    <td class="first-cell" style=""><span>{$v.name}</span></td>
                    <td><span>{$v.goods_sn}</span></td>
                    <td align="right"><span>{$v.shop_price} </span></td>
                    <td align="center">
                        <span name="checked_{$v['id']}"><if condition='$v.status eq 3'>审核管理员审核通过
                            <elseif condition='$v.status eq 1'/>
                            审核提交
                            <elseif condition='$v.status eq 2'/>
                            药师审核通过
                            <else/>
                            未审核
                        </if></span>
                    </td>
                    <td align="center">
                        <img src="__PUBLIC__/Images/images/<if condition='$v.is_sale eq 1'>yes<else/>no</if>.gif"/>
                    </td>
                    <td align="center">{$v.sort}</td>
                    <td align="right">{$v.num}</td>
                    <td align="center">{$v.sale_num}</td>

                    <td align="center">
                        <a href="{:U('/Index/Goods/index/id/'.$v['id'])}" target="_blank" title="查看">
                            <img src="__PUBLIC__/Images/images/icon_view.gif" width="16" height="16" border="0"/>
                        </a>
                        <a name="check_{$v['id']}" href="javascript:void 0;"
                           onclick="submitCheck({$v['id']},'{:U(GROUP_NAME.'/Check/runCheck')}',<if condition='$v.status eq 1 '>2<else/>3</if>)" title="提交">
                            <img src="__PUBLIC__/Images/images/check.png" width="16" height="16" border="0"/>
                        </a>
                    </td>
                </tr>
            </foreach>
        </table>
    </div>
<script language="JavaScript">
    function submitCheck($id, $url, $status) {

        var xmlhttp = new XMLHttpRequest();
        xmlhttp.open("POST", $url, false);
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlhttp.send("id=" + $id + "&status=" + $status);
//        alert(xmlhttp.responseText);
        if (xmlhttp.responseText==true) {
            if ($status == 1) {
                $str = '审核提交'
            } else if ($status == 2) {
                $str = '药师审核通过'
            } else {
                $str = '审核管理员审核通过'
            }
            document.getElementsByName('check_' + $id)[0].style.display = 'none';
            document.getElementsByName('checked_' + $id)[0].innerHTML = $str;

        } else {
            alert('请求出错，请稍后重试');
        }
    }
</script>
</body>
</html>    